package service

import (
	"todolist/internal/model"
	"todolist/internal/repository"
)

type TodoService struct {
    todoRepo *repository.TodoRepository
}

func NewTodoService(todoRepo *repository.TodoRepository) *TodoService {
    return &TodoService{todoRepo: todoRepo}
}

func (s *TodoService) CreateTask(userID int, title, description string, completed bool) (*model.Todo, error) {
    task := &model.Todo{
        Title:       title,
        Description: description,
        Completed:   completed,
        UserID:      userID,
    }

    if err := s.todoRepo.Create(task); err != nil {
        return nil, err
    }

    return task, nil
} 